import request from '@/utils/request'

const aiSecretApi = {
    /**
     * 密钥通道
     */
    channel(scene: string): Promise<any> {
        return request.get({
            url: '/setting/ai/secret/channel',
            params: {
                scene
            }
        })
    },
    /**
     * 密钥列表
     */
    lists(params: {
        page_no?: number;
        page_size?: number;
        channel?: string;
        scene: string;
        status?: number;
        keyword?: string;
    }): Promise<any> {
        return request.get({
            url: '/setting/ai/secret/lists',
            params
        })
    },
    /**
     * 密钥详情
     */
    detail(id: number): Promise<any> {
        return request.get({
            url: '/setting/ai/secret/detail',
            params: { id }
        })
    },
    /**
     * 密钥新增
     */
    add(params: {
        scene: string;
        channel: string;
        mark?: string;
        app_id?: string;
        api_key?: string;
        api_secret?: string;
        sort?: number;
        is_disable?: number;
    }): Promise<any> {
        return request.post({
            url: '/setting/ai/secret/add',
            params
        })
    },
    /**
     * 密钥编辑
     */
    edit(params: {
        id: number;
        scene: string;
        channel: string;
        mark?: string;
        app_id?: string;
        api_key?: string;
        api_secret?: string;
        sort?: number;
        is_disable?: number;
    }): Promise<any> {
        return request.post({
            url: '/setting/ai/secret/edit',
            params
        })
    },
    /**
     * 密钥删除
     */
    delete(id: number): Promise<any> {
        return request.post({
            url: '/setting/ai/secret/delete',
            params: { id }
        })
    },
    /**
     * 密钥停用
     */
    disable(id: number): Promise<any> {
        return request.post({
            url: '/setting/ai/secret/disable',
            params: { id }
        })
    }
}

export default aiSecretApi
